package cn.anlucky.apiadmin.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {

    private Integer code;
    private String Message;
    private Object data;


    /**
     * 请求成功
     *
     * @param message
     * @param data
     * @return
     */
    public static R success(String message, Object data) {
        return new R(1, message, data);
    }

    /**
     * 请求成功
     * @param code
     * @param message
     * @param data
     * @return
     */
    public static R success(Integer code ,String message, Object data) {
        return new R(code, message, data);
    }
    public static R success(Object data) {
        return new R(1, "成功", data);
    }

    public static R success(String message) {
        return new R(1, message, null);
    }

    public static R error(String message,Object data) {
        return new R(0, message, data);
    }
    public static R error(String message) {
        return new R(0, message, null);
    }

    public static R error(Integer code,String message,Object data) {
        return new R(code, message, data);
    }


}
